<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>添加众筹</title>
 
<link href="${ctx}/resources/media/css/chosen.css" rel="stylesheet"
	type="text/css" />
<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/bootstrap-wysihtml5.css" />
<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/select2_metro.css" />
<script type="text/javascript"
	src="${ctx}/resources/media/js/bootstrap-fileupload.js"></script>
<script type="text/javascript"
	src="${ctx}/resources/media/js/chosen.jquery.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/datetimepicker.css" />
<link rel="stylesheet" href="${ctx}/resources/media/css/dialog.css" />
<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/bootstrap-fileupload.css" />
<script type="text/javascript"
	src="${ctx}/resources/media/js/bootstrap-fileupload.js"></script>
<link href="${ctx}/resources/media/css/jquery.fancybox.css"
	rel="stylesheet" />

<link href="${ctx}/resources/media/css/chosen.css" rel="stylesheet"
	type="text/css" />

<link rel="shortcut icon"
	href="${ctx}/resources/media/image/favicon.ico" />
</head>
<body>
	<div class="row-fluid profile">
		<div class="span12">
			<!--BEGIN TABS-->
			<div class="tabbable tabbable-custom tabbable-full-width">
				<ul class="nav nav-tabs">
					<li><a href="${ctx}/investcrowd/limit">众筹列表</a></li>		
					<li class="active"><a href="${ctx}/investcrowd/limit/add">编辑众筹</a></li>
				</ul>
				<div class="tab-content">
					<!--end tab-pane-->
					<div class="tab-pane profile-classic row-fluid active" id="tab_1_2">
						<div class="span12">
							<!-- BEGIN SAMPLE FORM PORTLET-->
							<div class="portlet box blue">
								<div class="portlet-title">
									<div class="caption">
										<i class="icon-reorder"></i> <span class="hidden-480">添加众筹</span>
									</div>
								</div>
								<!-- END SAMPLE FORM PORTLET-->
								<div class="portlet-body form ">
									<form class="form-horizontal" id="form"
										action="${ctx}/investcrowd/limit/save" method="post"
										enctype="multipart/form-data">
										<fieldset>
												<input id="status" type="hidden" name="status"
												value="${investCrowdLimit.status==null?0:investCrowdLimit.status }">
												<input id="id" type="hidden" name="id"
												value="${investCrowdLimit.id }">
												<input id="version" type="hidden" name="version"
												value="${investCrowdLimit.version }">
												<input
												id="image" type="hidden" name="image"
												value="${investCrowdLimit.image }">
												<input id="totalLevel" type="hidden" name="totalLevel"
												value="${investCrowdLimit.totalLevel==null?0:investCrowdLimit.totalLevel }">
											<h4 class="form-section">添加众筹</h4>
											<div class="row-fluid">
												<div class="span6">
													<div class="control-group">

														<label class="control-label">商户编号</label>
														<div class="controls">
															<input type="text" id="merchantId" name="merchantId"
																class="m-wrap input-xlarge" value="${investCrowdLimit.merchantId }" readonly="readonly">
															<span class="help-inline"></span>
														</div>
													</div>
												</div>
												<div class="span6">
													<div class="control-group">

														<label class="control-label">众筹编号</label>
														<div class="controls">
															<input type="text" name="crowdNo" id="crowdNo"
																class="m-wrap input-xlarge" value="${investCrowdLimit.crowdNo }" readonly="readonly">
																<span class="help-inline"></span>
														</div>
													</div>
												</div>
											</div>
											<div class="row-fluid">
												<div class="span6">
													<div class="control-group">

														<label class="control-label">众筹名称</label>
														<div class="controls">
															<input type="text" id="crowdName" name="crowdName"
																class="m-wrap input-xlarge" value="${investCrowdLimit.crowdName }">
															<p class="help-block"></p>
														</div>
													</div>
												</div>
												<div class="span6">
													<div class="control-group">

														<label class="control-label">余额控制方式</label>
														<div class="controls">
                                                               <select id="amountControlMethod" name="amountControlMethod" class="select" style="width:285px" onchange="onClickAmountControlMetnod()">
                                                               <c:if test="${investCrowdLimit.amountControlMethod== 0}">
                                                               <option value="0" selected>按众筹项目份数控制</option>
                                                               <option value="1">按众筹项目分阶段份数控制</option>
                                                               </c:if>
                                                               	<c:if test="${investCrowdLimit.amountControlMethod== 1}">
                                                               	<option value="0">按众筹项目份数控制</option>
                                                                <option value="1" selected>按众筹项目分阶段份数控制</option>
                                                               </c:if>
                                                               <c:if test="${investCrowdLimit.amountControlMethod== null}">
                                                               <option value="0">按众筹项目份数控制</option>
                                                               <option value="1">按众筹项目分阶段份数控制</option>
                                                               </c:if>
                                                            </select>
                                                            <p class="help-block"></p>
                                                        </div>
													</div>
												</div>
											</div>

											<div class="row-fluid">
												<div class="span6">
													<div class="control-group">

														<label class="control-label">总份数</label>
														<div class="controls">
															<input type="text" id="limit" name="limit"
																class="m-wrap input-xlarge" value="${investCrowdLimit.limit }" onchange="onChangeLimit()">
															<p class="help-block"></p>
														</div>
													</div>
												</div>
												<div class="span6">
													<div class="control-group">

														<label class="control-label">数量余额</label>
														<div class="controls">
															<input type="text" id="balance" name="balance"
																class="m-wrap input-xlarge" value="${investCrowdLimit.balance }" readonly="readonly">
															<p class="help-block"></p>
														</div>
													</div>
												</div>
											</div>

											<div class="row-fluid">
													<div class="control-group" id="fileUpload">
													<label class="control-label" for="input01">广告图片</label>
													<div class="controls">
														<div class="fileupload fileupload-new" id="f1"
															data-provides="fileupload">
															<div class="row-fluid">
																<c:if test="${investCrowdLimit.image != null}">
																	<div class="span3">
																		<div class="item">
																			<a class="fancybox-button" data-rel="fancybox-button"
																				title="产品图片"
																				href="${investCrowdLimit.image}">
																				<div class="zoom">
																					<img src="${investCrowdLimit.image}"
																						alt="点击浏览产品图片" />
																					<div class="zoom-icon"></div>
																				</div>
																			</a>
																		</div>
																	</div>
																</c:if>
															</div>
															<div class="input-append">
																<div class="uneditable-input">
																	<i class="icon-file fileupload-exists"></i><span
																		class="fileupload-preview"></span>
																</div>
																<span class="btn btn-file"> <span
																	class="fileupload-new">添加产品图片</span> <span
																	class="fileupload-exists">更改</span> <input type="file"
																	name="file" class="default" accept=".jpeg,.jpg,.png"/>
																</span> <a href="#" class="btn fileupload-exists"
																	data-dismiss="fileupload">移除</a>
															</div>
														</div>
													</div>
												</div>
											</div>
											<div class="row-fluid">
                                                        <div class="span6">
                                                            <div class="control-group">
                                                                <!-- Text input-->
                                                                <label class="control-label">开始时间</label>
                                                                <div class="controls">
                                                                    <div class="input-append date form_meridian_datetime">
                                                                        <input size="16" type="text" id="startTime" name="startTime" value='<fmt:formatDate value="${investCrowdLimit.startTime }" pattern="yyyy-MM-dd HH:mm"/>'  class="m-wrap">
                                                                        <span class="add-on"><i class="icon-remove"></i></span>
                                                                        <span class="add-on"><i class="icon-calendar"></i></span>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="span6">
                                                            <div class="control-group">
                                                                <!-- Text input-->
                                                                <label class="control-label">结束时间</label>
                                                                <div class="controls">
                                                                    <div class="input-append date form_meridian_datetime">
                                                                        <input size="16" type="text" id="endTime" name="endTime" value='<fmt:formatDate value="${investCrowdLimit.endTime }" pattern="yyyy-MM-dd HH:mm"/>' class="m-wrap">
                                                                        <span class="add-on"><i class="icon-remove"></i></span>
                                                                        <span class="add-on"><i class="icon-calendar"></i></span>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span6">
													<div class="control-group">

														<label class="control-label">有效期</label>
														<div class="controls">
															<input type="text" id="activePeriod" name="activePeriod"
																class="m-wrap input-xlarge" value="${investCrowdLimit.activePeriod }" maxlength="40">
															<p class="help-block"></p>
														</div>
													</div>
												</div>
												<div class="span6">
													<div class="control-group">

														<label class="control-label">众筹类型</label>
														<div class="controls">
                                                               <select id="crowdType" name="crowdType" class="select" style="width:285px">
                                                               <c:if test="${investCrowdLimit.crowdType== 3}">
                                                               <option value="3" selected>产品众筹</option>
                                                               <option value="4">股权众筹</option>
                                                               </c:if>
                                                               	<c:if test="${investCrowdLimit.crowdType== 4}">
                                                               	<option value="3">产品众筹</option>
                                                                <option value="4" selected>股权众筹</option>
                                                               </c:if>
                                                               <c:if test="${investCrowdLimit.crowdType== null}">
                                                               <option value="3">产品众筹</option>
                                                               <option value="4">股权众筹</option>
                                                               </c:if>
                                                            </select>
                                                            <p class="help-block"></p>
                                                        </div>
													</div>
												</div>
                                            </div>
											<div class="row-fluid">
												<div class="control-group">

													<label class="control-label" for="input01">众筹项目描述</label>
													<div class="controls">
														<textarea class="wysihtml5 m-wrap" style="width: 1100px"
															name="description" id="description" rows="6">${investCrowdLimit.description }</textarea>
														<p class="help-block"></p>
													</div>
												</div>
											</div>
										</fieldset>
										<div class="form-actions">
											<button type="submit" class="btn blue ibtsubmit">
												<i class="icon-ok"></i> 保存
											</button>
											<button type="button" onclick="history.go(-1)" class="btn">取消</button>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--END TABS-->
			</div>
		</div>
	</div>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/jquery.dataTables.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/DT_bootstrap.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/select2.min.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/wysihtml5-0.3.0.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/bootstrap-wysihtml5.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/form-crowd-validate.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/jquery.validate.min.js"></script>
	<script src="${ctx}/resources/media/js/jquery.fancybox.pack.js"></script>

	<script type="text/javascript"
		src="${ctx}/resources/media/js/chosen.jquery.min.js"></script>
	<script src="${ctx}/resources/media/js/app.js"></script>

	<script src="${ctx}/resources/media/js/gallery.js"></script>
	<script type="text/javascript">
		var dt;
		var count = 1;
		$(function() {
			$("select").select2();
			
			if($("#amountControlMethod").val()==1) {
				$('#limit').attr("readonly","readonly");
				$("#balance").val("");
				$('#limit').val("");
			} else {
				$('#limit').removeAttr("readonly");
			}
			
			FormAdvertValidate.init();
			Gallery.init();
			//FormFileUpload.init('${ctx}');

			if ($('.wysihtml5').size() > 0) {
				$('.wysihtml5').wysihtml5({});
			}

		});

		function onChangeLimit() {
			$("#balance").val($("#limit").val());
		}
		
		function onClickAmountControlMetnod() {
			if($("#amountControlMethod").val()==1) {
				$('#limit').attr("readonly","readonly");
				$("#balance").val("");
				$('#limit').val("");
			} else {
				$('#limit').removeAttr("readonly");
			}
		}
		
		
		$(".form_meridian_datetime").datetimepicker({
			format : "yyyy-m-d h:i",
			//showMeridian: true,
			language : "zh",
			autoclose : true,
			pickerPosition : (App.isRTL() ? "bottom-right" : "bottom-left"),
			todayBtn : true
		});

	</script>


</body>
</html>